<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>欢迎，请登陆</title>

    <link type="text/css" rel="stylesheet" href="/css/all.css"/>
    <script language="javascript" src="/js/all.js"></script>
</head>
<body style="background-color: #444;">
    <div class="middle">
        <div style="font-size: 1.8em; font-weight: bold; text-align: center;">
            <span style="color: white">Spring</span>
            <span style="color: red">Cloud</span>
        </div>
        <div style="width: 25em; margin: 1em auto 0;">
            <div class="box box-primary">
                <div class="box-header with-border" style="padding: 10px 15px;">欢迎来到SpringCloud，请登录</div>
                <div class="box-body" style="padding: 15px 15px;">
                    <form>
                        <div class="form-group">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-users"></i></span>
                                <input id="loginName" class="form-control" placeholder="请输入您的手机、邮箱、用户名" type="text">
                            </div>
                        </div>
                        <div class="form-group no-margin">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-key"></i></span>
                                <input id="passWord" class="form-control" placeholder="请输入您的密码" type="password">
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-footer" style="padding: 10px 15px;">
                    <input id="doLogin" type="button" class="btn btn-primary pull-right" value="登录">
                </div>
            </div>
        </div>
    </div>

    <script language="JavaScript">
        $("#doLogin").click(function(){
            var loginName = $("#loginName").val();
            var passWord = $("#passWord").val();
            ajax.doAjax({
                type: "POST",
                url: urls.backend.userModule.login,
                data: {loginName: loginName, passWord: passWord},
                success: function(data, status, xhr){
                    window.location.href = urls.front.index;
                },
                error: function(xhr, textStatus, errorThrown){
                    if (xhr.status === 401) {
                        ajax.defaultOnError("用户名或密码错误");
                    } else {
                        ajax.defaultOnError(ajax.errMsg);
                    }
                }
            });
        })
    </script>
</body>
</html>